Replace

Definition:

Replace(text, search, replacement[, start[, count[, mode]]])

 

Description:

Replace a specified section of a string with another string.

 

Platforms:

All

 

Parameters:

text - required

String in which you want to replace text.

 

search - required

The text you want to replace.

 

replacement - required

The replacement text.

 

start - optional

Position within the string from which to start searching.

The default if this parameter is omitted is 1, which is the first character.

 

count - optional

The number of substitutions to perform or -1 to perform all possible substitutions.

The default if the parameter is omitted is -1.

 

mode - optional

Specify whether comparison should be case-sensitive or not:

"Text", 0 or "0" - Case-insensitive

"Binary", 1 or "1" - Case-sensitive

The default if this parameter is omitted is case-insensitive.

 

Returns:

The modified string.

 

Notes:

If you pass an empty string, "", in the replacement parameter, the search text will be deleted from the original string.

Start, count and mode parameters are optional but must occupy the positions given above – consequently, if you want to include one you must also include any which come before it in the list, e.g. Replace("Good morning, Mr Morning", "morning", "afternoon", 1, -1, 1).